﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RemotingObject
{
    /// <summary>
    /// 交换类
    /// </summary>
    public class Swap : MarshalByRefObject
    {
        #region Event

        public event MyDelegate SwapSubscribeAtClient; // 在服务器触发,在客户端订阅的事件

        #endregion

        #region 方法

        /// <summary>
        /// 服务器触发事件
        /// </summary>
        /// <param name="msg"></param>
        public void TriggerAtServerSwapEvent(string msg)
        {
            if (SwapSubscribeAtClient != null)
                SwapSubscribeAtClient(msg);
        }

        #endregion

        #region Override

        /// <summary>
        /// 无限生命周期
        /// </summary>
        /// <returns></returns>
        public override object InitializeLifetimeService()
        {
            return null;
        }

        #endregion
    }
}
